<div class="tableform">
  <form action="index.php?app=taoguaninventory&ctl=admin_codestate&act=save" method="post" id="newAddrForm">
    <table border="0" class='gridlist'>
	<thead>
      <tbody>
        <tr>
          <th style=" white-space:nowrap;">标识：</th>
          <td><{$state.name}>
           </td>
        
        </tr>
		    <tr>
          <th style=" white-space:nowrap;">前缀:</th>
          <td>
		
            <input id="head" name="head" type="text" size="15" value='<{$state.head}>' vtype="required"/></td>
         
        </tr>
        <tr>
          <th style=" white-space:nowrap;">编码长度：</th>
          <td>
		  <input id="bhlen" name="bhlen" type="text" size="15" value='<{$state.bhlen}>' vtype="required&&number"/></td>
        
        </tr>
      <tr>
          <th style=" white-space:nowrap;">用途:</th>
          <td>
		  <{$state.description}>
		</td>
       
        </tr>
		 <tr>
          <th style=" white-space:nowrap;">当前编号:</th>
          <td>
		  <{$state.currentno}>
		</td>
       
        </tr>
      </tbody>
	  </thead>
    </table>
    <div class="table-action">
      <{button label="保存" class="btn-primary" id="btn_submit_addr" type="button"}> &nbsp; &nbsp;
      <{button label="取消" class="btn-secondary" isCloseDialogBtn="true"}>
    </div>
	<input type='hidden' name='eid' value='<{$state.eid}>'>
  </form>
</div>
<script>
  (function(){
	$('btn_submit_addr').addEvent('click',function(e){
		var _this=this;
		 var form=this.getParent('form');
		 var bhlen = $('bhlen').value;
		if(bhlen<=0){
			return MessageBox.error('<{t}>编码长度不可小于等于0<{/t}>');
		}
		 form.store('target',{
              onRequest:function(){
                    _this.disabled=true;
                },
                onComplete:function(jsontext){
				
                    try{
                        var json = Json.evaluate(jsontext);
				
                        if (typeof(json.error) != 'undefined'){
                            _this.disabled=false;
                        }else{
                            _this.disabled=true;
							_this.getParent('.dialog').retrieve('instance').close();
                           window.finderGroup['<{$env.get.finder_id}>'].refresh(true);
                          
                        }
                    }catch(e){}
                }
            });
			 form.fireEvent('submit',e);
	
	});

 

  })()
</script>
